package org.example.booksmanagementsystem.enums;

public enum BookInfoStatusEnum {
    DELETED(0,"已经删除"),
    NORMALL(1,"允许借阅"),
    FORBIDDEN(2,"禁止借阅"),
    SPECIALDEAL(3,"特价秒杀");


    public static BookInfoStatusEnum getNameByCode(int code){
        switch(code) {
            case 0: return BookInfoStatusEnum.DELETED;
            case 1: return BookInfoStatusEnum.NORMALL;
            case 2: return BookInfoStatusEnum.FORBIDDEN;
            case 3: return BookInfoStatusEnum.SPECIALDEAL;
            default:
                return BookInfoStatusEnum.FORBIDDEN;
        }
    }


    private int code;
    private String name;

    BookInfoStatusEnum(int code, String name){
        this.code= code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
